package com.ruyuan.ingestion.parser.hbase;

import com.ruyuan.ingestion.parser.UserFriendParser;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

public class HBaseUserFriendParser extends UserFriendParser<Put> {
    @Override
    public Put parse(String[] fields) {
        //rowKey
        Put put = new Put(Bytes.toBytes(fields[0]+"-"+fields[1]));

        put = put.addColumn(Bytes.toBytes("uf"),Bytes.toBytes("user_id"),Bytes.toBytes(fields[0]));
        put = put.addColumn(Bytes.toBytes("uf"),Bytes.toBytes("friend_id"),Bytes.toBytes(fields[1]));
        return put;
    }
}
